using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Storage;
using Microsoft.Xna.Framework.Content;

namespace TimeWar
{
    public class Starship: AI_PlayableObject
    {

        // Set the 3D model to draw.
        //protected ThreeDimensionalObject shape = null;
        Cue engineSound = null;

        public Starship(Game game, String modelLocn, Screen currScreen)
            : base(game, modelLocn, currScreen, ShapeTypes.Starship)
        {
            // TODO: Construct any child components here
        }



        protected override void playMotionSound()
        {
            Sound.setEmitterPosition(position);

            if (engineSound == null)
            {
                engineSound = Sound.Play(Sounds.ThrustPlayer1, position);
            }
            
        }

        protected override void stopMotionSound()
        {
            if (engineSound != null)
            {
                Sound.Stop(engineSound);
                engineSound.Dispose();
                engineSound = null;
            }
        }

        public override void fireWeapon(int index, TimeSpan time)
        {
            Weaponry munitions = null;

            if (weapons.Count <= index)
            {
                //munition = new Weapon(gameObj, player, position, direction, direction, time, null, "Models\\mgun_proj");
                munitions = new Weaponry(gameObj);
            }
            else
            {
                munitions = weapons[index];
            }

            //Particles particles = new Particles(gameObj);
            Weapon photonTorp = new Missile(gameObj, player, position, direction, direction, time, "Content\\Models\\mgun_proj");
            photonTorp.Scale = 0.01f;
            //screen.OnscreenWeapons.Add(photonTorp);
            screen.addScreenObject(photonTorp);

            //Projectile bullet = new Projectile(gameObj, player, getWeaponPosition(), Vector3.Multiply(direction, velocity), direction, time, particles);

            //weapons[index].Add();
        }

        protected override void explosionSound()
        {
            currCue = Sound.Play(Sounds.ExplodeShip);
        }


    }
}
